| Fredy |
 |
Tuesday, April 14 2009 @ 05:08 PM CEST (Read 750 times) |
|
|

Advanced User
 Status: offline
Registered: 11/11/06
Posts: 62
|
Hi all,
I've somthing like this:
System :
"system" systemname=ID
"{"
(types+=SystemType)*
(components+=Component)*
"}";
SystemType :
ValueObject | Enumeration;
Component :
"component" componentName=ID
"{"
(types+=ComponentType)*
(providedPort+=Port)*
"}";
ComponentType :
ValueObject | Enumeration;
Port : "port" name=ID
"{"
(types+=PortType)*
(services+=Service)*
"}";
PortType :
ValueObject | Enumeration;
...
...
ValueObject : ("rem" description=STRING)? ("docUrl" docUrl=STRING)? "valueObject" name=ID "{"
(enumerations+=EnumerationRef)*
(voAttributes+=ValueObjectRef)*
"}";
ValueObjectRef :
("rem" description=STRING)? "voRef" type=[ValueObject] (multiplicity=Multiplicity)? name=ID ";";
The ValueObjects in scope System should only see the ValueObjects from scope System as ValueObjectRef.
The ValueObjects in scope Component should only see the ValueObjects from scope System and Component as ValueObjectRef.
and so on...
How can I realise this as ContentAssist and as Check Constraint? And how does this also works, if I import the Types (seperate Model File).
Are there any dokumentations or samples about something ?
Thanks Fredy
|
| |
|
|
| Christian Dietrich |
 |
Tuesday, April 14 2009 @ 05:11 PM CEST |
|
|

Expert
 Status: online
Registered: 10/11/06
Posts: 580
|
Not to reinvent the wheel have a look at http://code.google.com/p/metamodelsemantics/. there is a scoping feature included that should help you to solve your problem.
and if you don't want to use it as solution you can still use is as inspiration.
|
| |
|
|
| Fredy |
 |
Tuesday, April 21 2009 @ 08:48 AM CEST |
|
|

Advanced User
 Status: offline
Registered: 11/11/06
Posts: 62
|
Hi Christian,
thank you very much for this hint! Very great tool !
But in praxis there are some pitfalls.
I've installed a standard eclipse 3.2.4 with oaw 4.3.1.
Then annotated my metamodel like this:
semantic annotation for
"platform:/resource/kdgComponents.dsl/src-gen/de/xyz/dsl/kdgComponents/kdgcomponentsdsl.ecore"
{
class ValueObject
{
uniqueNames valueObjectRefs
}
}
The generator generates "/kdgComponents.dsl/src/de/xyz/dsl/kdgComponents/Linking.ext"
link(emf::EObject this) :
let all = allLocalElements() :
all.typeSelect(kdgComponentsDsl::EnumerationRef).collect(e|e.link_type()) ->
all.typeSelect(kdgComponentsDsl::ValueObjectRef).collect(e|e.link_type()) ->
all.typeSelect(kdgComponentsDsl::ValueObjectParameter).collect(e|e.link_type()) ->
all.typeSelect(kdgComponentsDsl::EnumerationParameter).collect(e|e.link_type()) ->
null;
and there are some failures:
Couldn't find type kdgComponentsDsl::EnumerationParameter Linking.ext kdgComponents.dsl/src/de/kabeldeutschland/dsl/kdgComponents line: 33 openArchitectureWare Problem
Couldn't find type kdgComponentsDsl::EnumerationRef Linking.ext kdgComponents.dsl/src/de/kabeldeutschland/dsl/kdgComponents line: 30 openArchitectureWare Problem
Couldn't find type kdgComponentsDsl::ValueObjectParameter Linking.ext kdgComponents.dsl/src/de/kabeldeutschland/dsl/kdgComponents line: 32 openArchitectureWare Problem
Couldn't find type kdgComponentsDsl::ValueObjectRef Linking.ext kdgComponents.dsl/src/de/kabeldeutschland/dsl/kdgComponents line: 31 openArchitectureWare Problem
Do you have any idea what's going wrong? Is there a problem with my model?
Who besides Markus knows seman?
Thanks Fredy
|
| |
|
|
| Christian Dietrich |
 |
Tuesday, April 21 2009 @ 10:44 AM CEST |
|
|

Expert
 Status: online
Registered: 10/11/06
Posts: 580
|
one question: kdgComponentsDsl is the name of you Xtext Model's Package?
|
| |
|
|
| Fredy |
 |
Tuesday, April 21 2009 @ 12:30 PM CEST |
|
|

Advanced User
 Status: offline
Registered: 11/11/06
Posts: 62
|
I think not ?!
my dsl is in: src/kdgComponentsDsl.xtxt
generate.properties:
language.name=kdgComponentsDsl
Fredy
|
| |
|
|
| Christian Dietrich |
 |
Tuesday, April 21 2009 @ 02:37 PM CEST |
|
|

Expert
 Status: online
Registered: 10/11/06
Posts: 580
|
Are the errors just in the .ext editor or in runtime too?
|
| |
|
|
| Fredy |
 |
Tuesday, April 21 2009 @ 02:49 PM CEST |
|
|

Advanced User
 Status: offline
Registered: 11/11/06
Posts: 62
|
No refresh problem ;-)
it is also an error when executing the workflow in the runtime-woprkbench.
Fredy
|
| |
|
|
| Christian Dietrich |
 |
Tuesday, April 21 2009 @ 03:27 PM CEST |
|
|

Expert
 Status: online
Registered: 10/11/06
Posts: 580
|
strange. and kdgComponentsDsl::EnumerationParameter and the other types exist in your xtext metamodel?
|
| |
|
|
| Christian Dietrich |
 |
Tuesday, April 21 2009 @ 10:32 PM CEST |
|
|

Expert
 Status: online
Registered: 10/11/06
Posts: 580
|
Hi i did some additional reasearch. metamodelsemantics has problems with camelcase languagenames.
see http://code.google.com/p/metamodelsemantics/issues/detail?id=6
The best (fastest) way is to change the languagename to lower case
(otherwise you could check out metamodelsemantics and fix the
templates by writing «metamodelName.toLowerCase()»:: instead of «metamodelName»::
|
| |
|
|